#include "internal.h"

/*
 * Priority of the task has changed. Check to see if we preempt
 * the current task.
 */
static void prio_changed_fair(struct rq *rq, struct task_struct *p, int oldprio)
{
    if (!task_on_rq_queued(p))
        return;

    if (rq->cfs.nr_queued == 1)
        return;

    /*
     * Reschedule if we are currently running on this runqueue and
     * our priority decreased, or if we are not currently running on
     * this runqueue and our priority is higher than the current's
     */
    if (task_current_donor(rq, p))
    {
        if (p->prio > oldprio)
            resched_curr(rq);
    }
    else
        wakeup_preempt(rq, p, 0);
}
